function [DWL, DWL_pertax, DWL_perinc,DWL_tri, DWL_tri_pertax, DWL_tri_perinc]=compute_DWL(p_interest_univ_log,y_interest_univ_log,y_interest_log,g_level,g2_level,yy)

            %%%%%%%%%%%%%%%%%%%%%%%
            % INPUT
            %%%%%%%%%%%%%%%%%%%%%%%

p_interest_univ=p_interest_univ_log;
y_interest_univ=y_interest_univ_log;
y_interest=y_interest_log;

points=size(p_interest_univ_log,1);

y_interest_DWL=y_interest_univ_log(yy,1);
y_start=y_interest_DWL;

p_start=min(p_interest_univ);
p_final=max(p_interest_univ);

select=(y_interest==y_interest_univ(yy,1));
g_level_DWL=g_level(select);
g2_level_DWL=g2_level(select);

g22_level_DWL=NaN*g2_level_DWL;

            %%%%%%%%%%%%%%%%%%%%%%%
            % COMPUTE RESULTING DWL
            %%%%%%%%%%%%%%%%%%%%%%%

y_start_level=exp(y_interest_DWL);
p_start_level=exp(p_start);
p_final_level=exp(p_final);

[e_level, h_level, ~] = bound_demandcomp(y_start_level, p_start_level, p_final_level, points, g_level_DWL, g2_level_DWL, g22_level_DWL);

CV = e_level(points,1) - (exp(y_start));
DWL= CV - (exp(p_final) - exp(p_start))* h_level(points,1);

tax   = (exp(p_final)-exp(p_start))* h_level(points,1);

DWL_pertax=DWL/tax;
DWL_perinc=DWL/exp(y_start);

DWL_tri = 0.5*(h_level(1,1)-h_level(points,1))* (exp(p_final)-exp(p_start));
DWL_tri_pertax=DWL_tri/tax;
DWL_tri_perinc=DWL_tri/exp(y_start);

    %
